package utility;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

/**
 * Created by 000001159 on 2017/1/9.
 */
public class WaitElementUtil {

    public static WebElement waitVisit(WebDriver driver,WebElement element,long timeout) {
        return  new WebDriverWait(driver,timeout).until(ExpectedConditions.visibilityOf(element));
    }



    public static WebElement waitVisit(WebDriver driver,WebElement element) {
         return  waitVisit(driver, element, 30);
    }

    public static WebElement waitVisit(WebDriver driver,By by,long timeout) {
        return  new WebDriverWait(driver,timeout).until(ExpectedConditions.visibilityOfElementLocated(by));
    }


    public static WebElement waitVisit(WebDriver driver,By by) {
        return  waitVisit(driver,by,30);
    }
}
